FAT file system in palm OS computer

ABSTRACT

A handheld computer which uses a palm operating system and which incorporates a compact flash (CF+) interface for secondary data storage or interface to other devices and uses a FAT file system for file management with said CF+ media. The disclosure further include references to alternate types of secondary storage such as disk drives and multimedia cards and further discloses that the handheld computer may be embodied in a portable telephone of scanner.

CROSS REFERENCE TO RELATED APPLICATION

This application relates to an pending U.S. patent application Ser. No. 09/479,352 entitled SYSTEM AND METHOD FOR USE OF SECONDARY STORAGE WITH A HANDHAND PALM COMPUTER, filed on Jan. 7, 2000 and assigned to a common assignee, and hereby incorporated herein in its entirety.

FIELD OF THE INVENTION

The present invention generally relates to handheld computers, and more particularly relates to handheld computers using a palm operating system, and even more particularly relates to a system and method for using fat file systems in a handheld computer using the palm operating system.

BACKGROUND OF THE INVENTION

In the past, users of handheld computers using the palm operating system and derivatives thereof have been required to use a special file management system unique to the palm operating system environment. While this prior art palm file management system has been very successful in the past, it has several drawbacks.

First of all, the palm operating system environment does not have the capability for enhancement of the system through the use of secondary data storage devices. Secondly, the palm operating system environment does not support industry standard files such as normally used in personal computers. The palm operating system and derivatives of it are limited to use of .prc and .pdb formatted files, which are hereafter referred to as “palm file formats”. Conversely, all file formats other than .prc and .pdb may be referred to hereafter as “non-palm file formats”.

Consequently, there exists a need for improvement in use of secondary storage and standard pc formatted files used with handheld computers using a palm operating system and similar operating systems.

SUMMARY OF THE INVENTION

It is an object of the present invention to enhance the capabilities of handheld computers.

It is another object of the present invention to provide secondary storage for a handheld computer using a palm operating system like operating system.

It is a feature of the present invention to include a File Allocation Table (FAT) file system, (hereafter collectively referred to as “Ffs”) in conjunction with a palm operating system like operating system.

It is an advantage of the present invention to provide the capability for secondary storage and use of pc industry standard file types in a palm operating system environment.

The present invention is an apparatus and method for enhancing the capabilities of a handheld computer using the palm operating system by use of an Ffs, which is designed to satisfy the aforementioned needs, provide the previously stated objects, include the above-listed features, and achieve the already articulated advantages. The present invention is carried out in a “.prc and .pdb -less system” in a sense that the limitation to using only .prc and .pdb file extensions has been eliminated.

Accordingly, the present invention is a system and method for enhancing the capabilities of a handheld computer using the palm operating system, which is operable with an Ffs.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention may be more fully understood by reading the following description of the preferred embodiments of the invention, in conjunction with the appended drawings wherein:

FIG. 1 is a simplified block diagram representation of the enhanced operating system software of a handheld computer of the present invention.

DETAILED DESCRIPTION

Now referring to the drawings, where like numerals refer to like text throughout, and more particularly to FIG. 1, there is shown a simplified block diagram of the present invention, generally designated 100, including a Palm OS block 102, which represents prior art and well-known operating system software commercially available from 3COM corporation for use in conjunction with handheld computers manufactured and sold by 3COM, hereafter Palm computers. The term “handheld computer” is intended to be construed broadly so as to include any handheld electronic device which processes information such as portable phones, scanners, etc. The above-referenced patent application also includes discussion with respect to the Palm OS. Also shown in FIG. 1 is SanDisk compact flash software block 104, which represents prior art, well-known and commercially available software from SanDisk Corporation of Sunnyvale Calif. SanDisk compact flash software block 104 includes well-known and industry standard software used to implement Ffs's in compact flash devices in conjunction with the Windows family of operating systems. The present invention achieves its beneficial aspects through combination of Palm OS block 102, SanDisk compact flash software block 104, and TRGpro interface software 106, which is novel and innovative software used to port the SanDisk compact flash software block 104 to the Palm OS block 102.

The following description is first intended to provide broad background information, then provide detailed information relating to one preferred approach to carrying out the present invention.

FAT File System Library

This section of the detailed description is intended to introduce the use of, and provide a reference to, the Ffs (FAT File System) Library procedures. It is directed toward Palm OS application developers who wish to access CF cards from within their applications. It is assumed that the reader is familiar with the C programming language, in particular within the context of the Palm OS.

Section 1 of this document gives background detail on the FAT file system. Section 2 describes the use of shared libraries in Palm OS applications, summarizing the functionality provided by the Ffs Library. Section 3 details the shared data structures used by multiple functions in the Ffs library and describes each of the library calls, describing their function, parameters, and return value. Section 4 lists the possible error codes and their interpretation, and Section 5 discusses a sample project.

Section 1—FAT File System Overview

The FAT file system in this document refers to a system of file management on a storage device. The device is divided into clusters, each of which can be composed of one or more sectors. A cluster can be in one of three states:

Allocated to a file

Allocated to a directory

Unused or free

The mapping of the clusters is contained in a File Allocation Table (FAT), which is where the file system gets its name.

TRGPRO and the FAT File System

The handheld computer of the present invention, hereafter referred to as “TRGpro”, is merely an example of many different approaches to practicing the present invention. In this example, the TRGpro is a computing device built upon industry standards. It was designed with a slot to accept CompactFlash devices, which are rapidly becoming the standard for handheld computers. In keeping with this eye toward standards, its internal implementation for accessing CompactFlash memory cards is based upon a FAT file system.

The true advantage to using the FAT file system is that it is a standard also supported by PC's running any of the following operating systems:

MS-DOS (all versions)

Windows 3.1

Windows 95

Windows 98

Windows NT (all versions)

Windows 2000

For the TRGpro, the removable media is a CompactFlash memory card, but other media could be used as well. It should be noted that while it is believed that CompactFlash devices and memory cards may be presently be the preferred media for secondary storage of information, the present invention is intended to include uses of other secondary storage media such as multimedia cards, disk drives and etc. The benefits of a Ffs in combination with a Palm OS like operating system can be achieved irrespective of any particular secondary storage implementation.

Section 2—Ffs Library Overview

The Purpose of the FAT File System Library

The FAT File System (Ffs) shared library provides an interface to Compact Flash (CF) cards containing a FAT File System. The interface is based upon the unbuffered file/disk system and library calls typically used with the C language. Support is provided for manipulating both files and directories, simplifying the exchange of data between the Palm device and a PC. In addition, the high-capacities of existing CF cards allow Ffs-aware applications to create, read, and modify files much larger than the total storage space available on existing Palm devices. A document reader, for example, could access documents directly on a CF card, without first having to move the documents in the Palm device RAM or Flash.

Loading, Unloading, and Accessing the FFS Shared Library

Currently, the Ffs Library is implemented as a Palm OS shared library. To access the Ffs calls, an application must search for the library, load the library if not found, then open the library. Opening the library returns a library reference number that is used to access the individual functions within the library. When the application is finished with the library, it should close the library. The current version of the library does not support the sharing of open files between applications, and only one application should have the library open at any one time (though the system may have it open, also).

In one embodiment the calling application must include the header file ffslib.h. The source code of ffslib.h is included in its entirety at the end of this detailed description. This file contains the required constant definitions, structure typedefs, and function prototypes for the library. In addition, this file maps library functions calls to the corresponding system trap instructions, through which all library routines are accessed. If the caller requires notification of CF card insertion/removal events, it must also include notify.h and the PalmOS header NotifyMgr.h (requires OS 3.3 headers).

To find a loaded library, an application calls SysLibFind, specifying the library. If not found, an application loads the library using SysLibLoad, specifying the library type and creator IDs. For the Ffs library, the name, type and creator IDs are defined in ffslib.h as FfsLibName, FfsLibTypeID and FfsLibCreatorID, respectively. After loading the library, it must be opened with a call to FfsLibOpen. Opening the library allocates and initializes its global variables, and sets up the CF socket hardware.

Once the library is open, the application may make calls to the library functions. The first parameter to a library call is always the library reference number returned when the library is loaded. Most library calls return an integer result of 0 on success and −1 on failure. A more specific error code may be obtained through another library call.

The application that opens the library is responsible for closing and optionally unloading the library. The library is closed with the FfsLibClose call, and unloaded with the SysLibRemove call. The library can only be removed, however, if it is not in use by the system, as indicated by the value 0 returned from FfsLibClose. If still in use, FfsLibClose returns FFS_ERR_LIB_IN_USE. It is possible for an application to leave the library loaded when exiting. The library may then be accessed by other applications through the SysLibFind call, which returns a reference to an already-loaded library. Once the reference number is obtained, the library is opened as usual with FfsLibOpen call. In either case, however, the caller must open the library on startup and close it on exit. The library should not be left open between applications.

Currently, the name of the Ffs library used for SysLibFind is “Fsf.lib,” the creator ID is “FfsL,” and the type ID is “libr.” These constants are all defined in ffslib.h.

Summary of FFS Library Functions

The Ffs library calls may be grouped into six categories: disk management, directory management, file access, file management, library management, and error handling. The calls, grouped by category, are listed below, with brief descriptions of each call's function. An alphabetical listing with a detailed specification of each call is given in section 3.

Disk management • FfsCardIsATA check if inserted card is an ATA device. • FfsCardInserted check if a CF card is inserted. • FfsFlushdisk flush all buffers to flash. • FfsFormat format the card. • FfsGetdiskfree get the total size of the CF disk, and the amount of free space. • FfsGetdrive get the current working drive number. • FfsSetdrive set the current working drive number. Directory management • FfsChdir change the current working directory. • FfsFinddone free resources after a directory search. • FfsFindfirst start a directory search. • FfsFindnext continue a directory search. • FfsGetcwd get the current working directory. • FfsIsDir check if the specified path is a directory or file. • FfsMkdir create a directory. • FfsRename rename a directory. • FfsRmdir remove a directory. File access • FfsClose close a file. • FfsCreat create a new file. • FfsEof check if the current file pointer is at the end of the file. • FfsLseek move a file pointer. • FfsOpen open/create a file. • FfsTell get the current file pointer value. • FfsWrite write to a file. File management • FfsFlush flush an open file to disk. • FfsFstat get information about an open file. • FfsGetfileattr get file attributes. • FfsRemove delete a file. • FfsRename rename a file. • FfsSetfileattr set file attributes. • FfsStat get information about a file. • FfsUnlink delete a file (same as FfsRemove). Library management • FfsGetLibAPIVersion get the Ffs library version number. • FfsLibClose close the library. • FfsLibOpen open the library. Error handling • FfsGetErrno get the current global error result code. • FfsInstallErrorHandler install a critical error handler callback function. • FfsUnInstallErrorHandler remove the critical error handler callback function.

For the most part, these functions implement the low-level unbuffered I/O functions found in the C language. The buffered stream I/O functions, such as fopen and fprintf, are not supported, though they could be built on top of the Ffs library layer.

Although many Ffs library calls accept a drive letter as part of the path string, and routines are provided to get and set the default drive, the Ffs library and Nomad hardware currently support only a single drive. This drive is signified as number 0 or 1 (0 indicates current drive, 1 indicates the first drive), and path “A:”.

The Global Error Result Code

Most of the Ffs library calls return an integer error indicator, set to 0 for success and −1 for failure. Library calls that return some other type of value, such as a pointer or file offset, always reserve one value to indicate an error. In either case, a specific error code is loaded into the global ermo variable. The ermo variable is not cleared on a successful call, so at any given time it contains the last error code generated. The current errno value may be retrieved by calling FfsGetErrno.

Critical Error Handler Callback

If an I/O error occurs when accessing the CF card, a critical error handler is called. The critical error handler is responsible for deciding whether to abort or retry the current operation, to mark a failed sector as bad, or to reformat the card. The actual choices available in a specific situation are dependent on the type of critical error that occurred, and are determined by the internal critical error handler.

Regardless of the type of critical error that occurred, “abort current operation” is always a choice, and is the default action taken by the critical error handler. The calling program may supply its own critical error handler, however, to prompt the user for the desired course of action. A custom critical error handler is installed by a call to FfsInstallErrorHandler. The custom error handler takes as parameters a drive number, a code indicating the valid responses, and a string containing the specific error message, and returns the desired course of action. In current versions of the library, the drive number will always be 0. The codes defining the valid responses are listed below, along with corresponding course of action codes:

CRERR_NOTIFY_ABORT_FORMAT: CRERR_RESP_ABORT or CRERR_RESP_FORMAT.

CRERR_NOTIFY_CLEAR_ABORT_RETRY: CRERR_RESP_ABORT, CRERR_RESP_RETRY, or CRERR_RESP_CLEAR.

CRERR_NOTIFY_ABORT_RETRY: CRERR_RESP_ABORT or CRERR_RESP_RETRY.

The course of action codes are interpreted by the internal critical error handler as follows:

CRERR_RESP_ABORT: Abort the current operation.

CRERR_RESP_RETRY: Retry the current operation.

CRERR_RESP_FORMAT: Attempt to format the card.

CRERR_RESP_CLEAR: Clear corrupt sector and retry the current operation.

These codes are all defined in file ffslib.h.

The custom critical error handler will typically display an alert box containing the error message text passed in from the internal critical error handler and prompting the user with the choices appropriate for the error type. For example, if the CF card is removed during an operation, the custom error handler will be called with a response code of CRERR_NOTIFY_ABORT_RETRY and an error message of “Bad card”. The error handler would then display an alert with buttons for “Abort” and “Retry”. Note that the “Abort” button should return the default value 0, in case the user presses an application launch button when the alert is displayed (in this case, the system will force the default return value from all alerts until the running application terminates).

Card Insertion/Removal Notify

When a CF card is removed while the Ffs Library is loaded, the library automatically clears all data structures associated with the card and reinitializes in preparation for the next card. Thus, if a card is removed during a library call, the library will not be able to complete the call even if the card is reinserted. This is an unfortunate side effect of the fact that most CF storage cards are missing the unique serial number in the drive ID information that is used to identify the cards. Because of this omission, the library is unable to determine if a reinserted card is identical to the previously loaded card.

The library reinitialization is invisible to the calling application. In order to notify the caller of insertion/removal events, a launch code can be sent by the system to the application. Applications “register” at startup for notification of CF insertion/removal events, and are then sent the launch code sysAppLaunchCmdNotify when these events occur. The cmdPBP points to a 

We claim:
 1. A handheld computer comprising: a CPU executing a palm operating system in which executable programs are directly accessed from a permanent data storage in a database format; where said database format applies equally to data files which are formatted in palm file formats; file management software for use with said CPU for manipulation of files in Ffs file formats; and whereby said file management software interfaces a FAT file system with said palm operating system which is an operating system of a type otherwise incapable of opening files having non-palm file formats.
 2. A handheld computer of claim 1 further comprising an interface program disposed between said operating system and said file management software.
 3. A handheld computer of claim 2 wherein said interface software is implemented as a shared library.
 4. A handheld computer of claim 3 wherein said shared library permits manipulation of a stored file in a secondary storage media without a requirement to load said stored file into said permanent data storage.
 5. A handheld computer of claim 4 wherein said permanent data storage is RAM.
 6. A handheld computer of claim 4 wherein said permanent data storage is a flash memory.
 7. A handheld computer of claim 3 wherein said shared library performs the functions of disk management, directory management, file access, file management, library management, and error handling.
 8. A hand held computer of claim 7 wherein said shared library performs the functions of mapping a plurality of library function calls to a plurality of corresponding system trap instructions, through which all library routines are accessed.
 9. A hand held computer of claim 8 wherein said handheld computer is a handheld telephone having a microprocessor therein.
 10. A handheld computer of claim 8 wherein said handheld computer is a hand held scanner having a microprocessor therein.
 11. A handheld computer of claim 1 wherein said handheld computer is a hand held telephone having a microprocessor therein.
 12. A handheld computer of claim 1 wherein said handheld computer is a handheld scanner having a microprocessor therein.
 13. A method of manipulating files in a handheld computer, of the type which uses a palm operating system, the method comprising the steps of: providing a palm operating system driver for access by applications running on said handheld computer; said palm operating system driver including routines for interfacing a FAT file system with an operating system of the type otherwise incapable of opening non-palm file formats; providing a secondary storage media for storing files thereon in non-palm file formats; opening an application on said palm operating system with the use of permanent data storage directly accessible with the use of said palm operating system; and, opening a file from said secondary storage media, without loading said file into said permanent data storage directly accessible with the use of said palm operating system, by using said palm operating system driver.
 14. A method of claim 13 wherein said handheld computer is a handheld telephone having a microprocessor therein.
 15. An instruction set for use on a handheld computer, said instruction set including: operating system means for accessing palm operating system databases formatted in palm file formats; means for implementing an Ffs in a secondary storage media; means for interfacing said means for accessing palm operating system databases formatted In palm file formats with said means for implementing an Ffs in a secondary storage media; and wherein said means for accessing is of a type which is otherwise incapable of opening files having non-palm file formats.
 16. An instruction set of claim 15 wherein said secondary storage media is a compact flash media.
 17. An instruction set of claim 15 wherein said secondary storage media is a multimedia card.
 18. An instruction set of claim 15 wherein said secondary storage media is a disk drive.
 19. An instruction set of claim 15 wherein said handheld computer is a handheld telephone having a microprocessor therein. 